package test

fun main() {
    val stus = test1()
    println(stus)
    for (stu:Student in stus){
        println(stu)
    }
}

fun test1() :List<Student>{
    val books: List<Book> = listOf(Book("Java",11.0), Book("C",12.0))
    val students: List<Student> = listOf(Student("x", 12, books), Student("y", 11, books))
//    val student:Student= Student("x", 12, books)
     return students.map {
        val stu = it
        stu.books = it.books.map {
            if (it.bookName.equals("Java")) {
                it.bookName = "Java1"
                it
            } else if (it.bookName.equals("C")) {
                it.bookName = "C1"
                it
            } else {
                it
            }
        }
//        stu.name="zzz"
//        stu.age=10
        stu
    }
}

fun test2() {
    val students: List<Student> = listOf()
    val names = students.map { it.name }
    println(names)
}